<!doctype html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" >
<head>
	<meta charset="UTF-8">
	<meta name="viewport"
		  content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<div th:include="includeJs::includeJs"></div>
	<div th:include="resources::myjk_2"></div>
	<div th:include="includeJs::layui_js"></div>
	<div th:include="resources::loan_info"></div>
	<title>借贷详情</title>
</head>
<body>
	<div class="header">
		<div th:replace="includeJs::dingding_header"></div>
		<div class="clear"></div>
		<div th:replace="includeJs::dingding_nav">

		</div>
	</div>
	<div class="clear"></div>
	<div class="banner"></div>

	<div style=" width:100%; background:#f3f6f8">
		<div class="main">
			<!-- end banner -->
			<div class="bor_con_wper">
				<div class="bor_con px1000">
					<div class="bor_detail">
						<form action="addOrder" method="post" id="order_form">
							<table class="bor_table table " style="text-align: center;">
								<tr>
									<td colspan="4" style="text-align: center"><span class="font-italic" style="font-size:20px;">信息详情</span></td>
								</tr>
								<tr>
									<td><span class="table_tit">申请人：</span></td>
									<td><label class="label_info" th:text="${user.realName}">XXX</label></td>
									<td><span  class="table_tit">借款金额：</span></td>
									<td><label class="label_info" th:text="${loan.LMoney}+'元'" style="color: red"></label></td>
								</tr>
								<tr>
									<td><span class="table_tit">借款期限：</span></td>
									<td><label class="label_info" th:text="${loan.LMonth}+'月'">XXX月</label></td>
									<td><span  class="table_tit">手机号：</span></td>
									<td><label class="label_info" th:text="${loan.LPhone}"></label></td>
								</tr>
								<tr>
									<td><span class="table_tit">借款利率：</span></td>
									<td><label class="label_info" th:text="${debit.yearInterset}+'%'" style="color: red">XXX</label></td>
									<td><span  class="table_tit">预计每月归还：</span></td>
									<td><label class="label_info" th:text="${(loan.LMoney*debit.yearInterset/100/12)+(loan.LMoney/loan.LMonth)}" style="color: red"></label></td>
								</tr>
								<tr>
									<td><span class="table_tit">身份证：</span></td>
									<td><label class="label_info" th:text="${loan.identityCard}">XXX</label></td>
									<td><span  class="table_tit">月收入：</span></td>
									<td><label class="label_info" th:text="${loan.monthlyProfit}+'元'"></label></td>
								</tr>
								<tr>
									<td><span class="table_tit">所在公司：</span></td>
									<td><label class="label_info" th:text="${loan.company}">XXX</label></td>
									<td><span  class="table_tit">公司电话：</span></td>
									<td><label class="label_info" th:text="${loan.companyPhone}">XXX</label></td>
								</tr>
								<tr>
									<td><span class="table_tit">所在地区：</span></td>
									<td><label class="label_info" th:text="${loan.address}">XXX</label></td>
									<td><span  class="table_tit">详细地址：</span></td>
									<td><label class="label_info" th:text="${loan.street}"></label></td>
								</tr>
								<tr>
									<td><span class="table_tit">借款用途：</span></td>
									<td><label class="label_info" th:text="${loan.purposeOfLoan}">XXX</label></td>
									<td><span  class="table_tit">借款描述：</span></td>
									<td><label class="label_info" th:text="${loan.commentOfLoan}"></label></td>
								</tr>
								<tr>
									<div th:each="c,p:${clan}">
										<td><span class="table_tit" th:text="'紧急联系人'+${p.index+1}+'：'"></span></td>
										<td><label class="label_info" th:text="'姓名：'+${c.CName}+'|关系：'+${c.CRelation}+'|电话：'+${c.CPhone}" >XXX</label></td>
									</div>
								</tr>
								<tr>
									<td><span class="table_tit">借款用途：</span></td>
									<td><label class="label_info" th:text="${loan.purposeOfLoan}">XXX</label></td>
									<td><span  class="table_tit">借款描述：</span></td>
									<td><label class="label_info" th:text="${loan.commentOfLoan}"></label></td>
								</tr>
								<tr>
									<td colspan="4" style="text-align: center">
										<input type="hidden" name="userId" th:value="${loan.userId}" />
										<input type="hidden" name="lMoney" th:value="${loan.LMoney}" />
										<input type="hidden" name="lMonth" th:value="${loan.LMonth}" />
										<input type="hidden" name="lPhone" th:value="${loan.LPhone}" />
										<input type="hidden" name="identityCard" th:value="${loan.identityCard}" />
										<input type="hidden" name="monthlyProfit" th:value="${loan.monthlyProfit}" />
										<input type="hidden" name="company" th:value="${loan.company}" />
										<input type="hidden" name="companyPhone" th:value="${loan.companyPhone}" />
										<input type="hidden" name="address" th:value="${loan.address}" />
										<input type="hidden" name="street" th:value="${loan.street}" />
										<input type="hidden" name="purposeOfLoan" th:value="${loan.purposeOfLoan}" />
										<input type="hidden" name="commentOfLoan" th:value="${loan.commentOfLoan}" />
										<input type="hidden" name="loanType" th:value="${loan.loanType}">
<!--										<input type="hidden" name="orderTime" th:value="${loan.orderTime}">-->
										<input type="hidden" name="orderState" th:value="${loan.orderState}">
										<input type="hidden" name="age" th:value="${loan.age}">
										<button type="button" class="btn btn-info" id="sub">确认信息</button>
									</td>
								</tr>
							</table>
						</form>
						<input class="btn btn-default" value="返回上一页" onclick="del()"/>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div id="password-div" class="password-div" style="display: none;margin-left: 120px;margin-top: 35px;">
		<label id="pwd" for="password" class="password-lable">
			<ul>
				<li></li>
				<li></li>
				<li></li>
				<li></li>
				<li></li>
				<li></li>
			</ul>
			<input id="password" type="password" name="password" maxlength="6">
		</label>
		<div style="margin-left: 38px;">
			<button type="button" id="qdcz" class="layui-btn layui-btn-danger  layui-btn-radius" style="width: 100px;">确定</button>
		</div>
	</div>
	<div style="display:none;text-align: center;" id="pop" class="pop">
		<img src="/newloan/img/duihao.png"/>
		<div class="div11"></div>
		<div><span style="font-size: 21px;">提交成功!<span style="color: #d6062d;" id="lay_count">3</span>秒后跳转页面!</span></div>
	</div>
	<div class="clear"></div>
	<div class="footer" style=" margin-top:125px">
	   <div class="footer_m">
		   <div class="footer_l">使用条款 | 隐私保护</div>
		   <div class="footer_r">© 2015 （杭州）金融信息服务有限公司    杭ICP备0000000号</div>
	   </div>
	</div>
</body>
<script type="text/javascript">
	$("#city").click(function (e) {
		SelCity(this,e);
	});
	$("s").click(function (e) {
		SelCity(document.getElementById("city"),e);
	});
	function del(){
		window.location.href="/loan/deleteClan";
		history.back(-1);
	}
	// $("#sub").click(function () {
	// 	//页面层
	// 	layer.open({
	// 		type: 1,
	// 		title: '提示',
	// 		skin: 'layui-layer-demo', //样式类名
	// 		area: ['500px', '300px'],
	// 		closeBtn: 2, //不显示关闭按钮
	// 		fixed: true, //不固定
	// 		maxmin: true,
	// 		content: $('#pop')
	// 	});
	// 	let zx = 3;
	// 	let zhuxin = setInterval(function () {
	// 		if(zx==0){
	// 			$("#order_form").submit();
	// 			clearInterval(zhuxin)
	// 		}
	// 		$("#lay_count").text(zx);
	// 		zx=zx-1;
	// 	},1000)
	// })
	$("#sub").click(function () {
		layer.open({
			type: 1,
			title: '请输入支付密码',
			skin: 'layui-layer-demo', //样式类名
			area: ['450px', '200px'],
			closeBtn: 2, //不显示关闭按钮
			fixed: false, //不固定
			maxmin: false,
			content: $('#password-div'),
			cancel: function(){//右上角关闭回调
				$("#pwd ul li").text('');
			}
		});
		$("#pwd").focus();
	})
	$("#qdcz").click(function () {
		let $password= $("#password").val();
		if(null == $password || $password.length!=6){
			layer.msg('请输入密码。',{time:2000,icon:2});
			return;
		}else {
			$.ajax({//支付交易密码
				url:"/loan/judgePwd",
				type:"post",
				data:{
					paypwd:$password
				},
				dataType:"json",
				success:function (data) {
					if(data ==0){
						layer.msg('提交成功',{time:1000,icon:1});
						//页面层
						layer.open({
							type: 1,
							title: '提示',
							skin: 'layui-layer-demo', //样式类名
							area: ['500px', '300px'],
							closeBtn: 2, //不显示关闭按钮
							fixed: true, //不固定
							maxmin: false,
							content: $('#pop')
						});
						let zx = 2;
						let zhuxin = setInterval(function () {
							if(zx==0){
								$("#order_form").submit();
								clearInterval(zhuxin)
							}
							$("#lay_count").text(zx);
							zx=zx-1;
						},1000)
					}else if(data==1){
						layer.msg("密码错误,请重新输入",{time:2000,icon:2});
						$("#pwd ul li").text('');
						return;
					}else if(data==2){
						layer.msg("账户已被锁定,请明天再试!",{time:2000,icon:2});
						$("#pwd ul li").text('');
						//$("#pwd").focus();
						return;
					}else if(data==3){
						layer.msg("您的余额不足,请充值后再试!",{time:2000,icon:2});
						return;
					}
				},
				error:function () {
					layer.msg('服务器错误!请稍后再试!');
				}
			})
		}
	})
	//查询支付密码
	$(".password-div input").on("input",function(e){ //标签为password-div下的input添加oninput事件
		let number = 6;   //定义输入最大值
		let pw = $("input[name = 'password']").val(); //定义pw为name是password的input框的输入值
		let list = $(".password-div ul li");  //定义list是li
		for(let i = 0; i < number ; i++){    //for循环遍历将·放入li标签
			if(pw[i]){
				$(list[i]).text("·");
			}else{
				$(list[i]).text("");
			};
		};
	});
	$(".password-div ul").click(function(){
		$("input[name = 'password']").val("");
		$("#password").focus();
		$(".password-div ul li").text("");
	});
	$(function () {
		$(document).keydown(function (e) {
			if (e.keyCode === 13) {
				$("#qdcz").click();
			}
		});
	});
</script>
</html>
